From 450da94ecd955f2a95c72e9f403aa6da6357a7ea Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Fri, 27 Jan 2017 09:54:43 -0800 Subject: [PATCH] Clarify error for repo-based dependencies when publishing. Specifically add a description of how to resolve the error. --- src/cargo/ops/registry.rs | 8 +++++--- tests/publish.rs | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index f3c8de934..e3492073f 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -81,9 +81,11 @@ fn verify_dependencies(pkg: &Package, registry_src: &SourceId) a version", dep.name()) } } else if dep.source_id() != registry_src { - bail!("all dependencies must come from the same source.\n\ - dependency `{}` comes from {} instead", - dep.name(), dep.source_id()) + bail!("crates cannot be published to crates.io with dependencies sourced from \ + a repository\neither publish `{}` as its own crate on crates.io and \ + specify a crates.io version as a dependency or pull it into this \ + repository and specify it with a path and version\n(crate `{}` has \ + repository path `{}`)", dep.name(), dep.name(), dep.source_id()); } } Ok(()) diff --git a/tests/publish.rs b/tests/publish.rs index cacf8faa4..fd3558a4e 100644 --- a/tests/publish.rs +++ b/tests/publish.rs @@ -115,8 +115,11 @@ fn git_deps() { .arg("--host").arg(registry().to_string()), execs().with_status(101).with_stderr("\ [UPDATING] registry [..] -[ERROR] all dependencies must come from the same source. -dependency `foo` comes from git://path/to/nowhere instead +[ERROR] crates cannot be published to crates.io with dependencies sourced from \ +a repository\neither publish `foo` as its own crate on crates.io and \ +specify a crates.io version as a dependency or pull it into this \ +repository and specify it with a path and version\n\ +(crate `foo` has repository path `git://path/to/nowhere`)\ ")); } -- 2.30.2